﻿using ShareCode.Entity.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShareCode.Dto.User
{
    public class LoginReturnDto
    {
        public string? Token
        {
            get; set;
        }

        public string? OrgName
        {
            get; set;
        }
        public string? OrgAvatar
        {
            get; set;
        }
        public string? WorkNO
        {
            get; set;
        }
        public int Gender
        {
            get; set;
        }

        public string? OrgTitle
        {
            get; set;
        }

        /// <summary>
        /// 系统功能编号
        /// </summary>
        public List<int> SysFun { get; set; } = new List<int>();

        private LoginReturnDto(UserAccountEntity userInfo)
        {
            if (userInfo != null)
            {
                Token = userInfo.Token;
            }
        }

        private LoginReturnDto(UserAccountEntity userInfo, UserEntryInformationEntity? EntryInformation) : this(userInfo)
        {
            if (EntryInformation != null)
            {
                OrgName = EntryInformation.UserName;
                OrgAvatar = EntryInformation.Avatar;
                WorkNO = EntryInformation.WorkNo;
                Gender = EntryInformation.Gender;
            }
        }

        public LoginReturnDto(UserAccountEntity userInfo, UserEntryInformationEntity? EntryInformation, UserOrgEntity? org) : this(userInfo, EntryInformation)
        {
            if (org != null)
            {
                OrgTitle = org.Title;

            }
        }

    }

}
